#!/usr/bin/env python

from celtuce.accessor import Accessor

import time


from celtuce.help import logging
logging.getLogger().setLevel(logging.LEVEL_DEBUG)


URL = 'tcp://127.0.0.1:14300'

def runTest() :
    accessor = Accessor( URL )
    try :
        accessor.lookupTabletServer('table_test','key_to_test')

        # test performance
        time_start = time.time()
        test_times = 10000
        for i in xrange(test_times) :
            accessor.lookupTabletServer('table_test','key_to_test')
        time_last = time.time() - time_start
        tps = test_times / time_last
        print 'test lookupTabletServer() %d times last %.2f seconds, tps=%.2f' % (test_times, time_last, tps)

    finally :
        accessor.shutdown()

    ## runTest()

if  __name__ == '__main__' :
    runTest()

